package com.ssy.lingxi.logistics.model.enums;

import com.ssy.lingxi.common.language.LanguageHolder;
import com.ssy.lingxi.logistics.api.validate.IntArrayValuable;

import java.util.Arrays;

/**
 * 通用布尔状态枚举
 *
 * @author yzc
 * @version 2.0.0
 * @date 2020/7/10
 */
public enum CommonBooleanEnum implements IntArrayValuable {

    /**
     * 否 - 0
     */
    NO(0, "否"),

    /**
     * 是 - 1
     */
    YES(1, "是");

    public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(CommonBooleanEnum::getCode).toArray();

    private Integer code;

    @Override
    public int[] array() {
        return ARRAYS;
    }

    CommonBooleanEnum(Integer code, String message) {
        this.code = code;
    }

    public Integer getCode() {
        return code;
    }

    public String getMessage() {
        return LanguageHolder.getName(this.getClass(),this.code);
    }

}
